package controller.commands;

import controller.Serializer;
import core.BoxNode;
import java.io.File;
import model.graphic.objects.GBoxNode;
import view.GUI.LabelReader;

/**
 *
 * @author Ben
 */
public class ImportBoxNodeCommand extends BasicCommand{
    private File file;

    public ImportBoxNodeCommand(File file) {
        this.file = file;
    }

    @Override
    public void execute() {
        Serializer s = new Serializer(null, null, file.getPath());
        GBoxNode gbn = s.deserializeBoxNode();
        BoxNode bn = (BoxNode)sync.get(gbn);
        AddBoxNodeCommand.addToPalette(gbn, bn, controller.getPalette(),gbn.getName(), LabelReader.getInstance().getString("info" + gbn.getName()));
    }

}
